package com.great.meal.search.dao;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

public interface GenericDao<T> {
	public void save(Object o);
	public void delete(Object o);
	public void deleteById(Serializable id);
	public void update(Object o);
	public void saveOrUpdate(Object o);
	
	public T getById(Serializable id);
	public Collection<T> findAll(Class<T> entityClass);
	
	/**
	 * 查询语句 执行HQL查询. 
	 * 几种参数形式: 1. 名字参数: from User user where user.name=:customername and user:customerage=:age
	 *  2. 位置参数: from User user where user.name=? and user.age =?
	 * @param queryString
	 * @return
	 */
	public List<?> find(String queryString);
	public List<?> find(String queryString, Object value);
	public List<?> findByNamedQuery(String queryName);
	public List<?> findByNamedQuery(String queryName, Object value);
	public List<?> findByNamedQueryAndNamedParam(String queryName, String paramName, Object value);
	public List<?> findByNamedQueryAndNamedParam(String queryName, String[] paramName, Object[] value);
	
	
	
	public Class<T> getTClass();
}
